package com.sky.controller.admin;

import com.sky.constant.MessageConstant;
import com.sky.dto.OrdersCancelDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.dto.OrdersRejectionDTO;
import com.sky.entity.Orders;
import com.sky.exception.OrderBusinessException;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.OrdersService;
import com.sky.vo.OrderStatisticsVO;
import com.sky.vo.OrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 订单
 */
@RestController
@RequestMapping("/admin/order")
@Slf4j
@Api(tags = "管理端订单接口")
public class OrderController {

    @Autowired
    private OrdersService ordersService;




    /**
     * @Author Anson
     @Date   2023/8/3 16:05
     @Param        * @param id
     @Description  派送订单
     @Return_type  * @return Result
     */
    @PutMapping("/delivery/{id}")
    @ApiOperation("派送订单")
    public Result deliveryOrders(@PathVariable Long id){
        ordersService.ordersStatus(id, Orders.DELIVERY_IN_PROGRESS);
        return Result.success();
    }
    /**
     * @Author Anson
     @Date   2023/8/3 16:06
     @Param        * @param id
     @Description  完成订单
     @Return_type  * @return Result
     */
    @PutMapping("/complete/{id}")
    @ApiOperation("完成订单")
    public Result completeOrders(@PathVariable Long id){
        ordersService.ordersStatus(id, Orders.COMPLETED);
        return Result.success();
    }

}
